//Shirasu Azusa 2024.5
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x)  {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x)  {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x)  {return (x==0?-1:__builtin_ctzll(x));}

#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} 
  return x*w;
}

const int N=2e6+5;
const double lim=1e9,eps=1e-8;
int n,top;
double ans,k[N],h[N],l[N],r[N],y[N];

struct seg {
  double l,r,a,b;
} st[N];

double gety(seg p,double x) {
  //assert(p.l<=x+eps&&x-eps<=p.r);
  double k=(p.b-p.a)/(p.r-p.l);
  return p.a+(x-p.l)*k;
}
double qry(int i,ld x) {
  if(x<=l[i]) return y[i];
  else return gety((seg){l[i],r[i],y[i],y[i]+h[i]},x);
}
bool intersect(seg x,int i){
  double rp=min(x.r,r[i]);
  double rx=gety(x,rp), ri=qry(i,rp);
  return rx+eps<ri;
}

signed main() {
  freopen("wan.in","r",stdin);
  freopen("wan.out","w",stdout);
  n=read();
  double mx=0;
  rep(i,1,n) h[i]=read(), l[i]=read(), r[i]=read(), mx=max(mx,r[i]), mx=max(mx,h[i]);
  int tick=0;
  per(i,n,1) {
    y[i]=y[i+1];
    while(top) {
      if(intersect(st[top],i)) {
        ld qwq=0; ++tick;
        for(ld l=0,r=lim;r-l>eps;) {
          ld mid=(l+r)/2; y[i]-=mid; qwq=mid;
          if(intersect(st[top],i)) l=mid;
          else r=mid;
          y[i]+=mid;
        }
        y[i]-=qwq;
      }
      if(r[i]<st[top].r+eps) {
        st[top].a=gety(st[top],r[i]);
        st[top].l=r[i];
        break;
      } else {
        --top;
      }
    }
    st[++top]=(seg){l[i],r[i],y[i],y[i]+h[i]};
    st[++top]=(seg){0,l[i],y[i],y[i]};
    //cout<<"C "<<i<<endl;
    //per(i,top,1) cout<<"seg "<<st[i].l<<" "<<st[i].r<<" "<<st[i].a<<" "<<st[i].b<<endl;
  }
  ld L=y[1], R=0;
  rep(i,1,n) chmax(R,y[i]+h[i]);
  printf("%.6Lf\n",R-L);
  return 0;
}